<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>判断字符是否唯一</title>
</head>

<body>
  <script>
    let str = 'ajhdabcdhajshdkajabc'
    var isUnique = function (astr) {
      if (astr instanceof String !== true) {
        // alert('非字符串无法判断')
        return astr + '属于非字符串，无法判断'
      }
      if (astr.length !== [...new Set(astr)].length) {
        return false
      }
      return true
    };
    // console.log(isUnique(str));
    // console.log(isUnique('jaklsiec'));
    console.log(isUnique(9));

  </script>
</body>

</html>